package ngat.oss;

import ngat.message.base.*;
import ngat.message.OSS.*;

public class TransactionUnit {

    protected TRANSACTION transaction;

    protected TRANSACTION_DONE done;

    protected boolean completed;

    public TransactionUnit(TRANSACTION transaction) {
	this.transaction = transaction;
    }

    public TRANSACTION getTransaction() { return transaction;}

    public TRANSACTION_DONE getDone() { return done; }

    public void setDone(TRANSACTION_DONE done) { this.done = done; }

    public boolean isCompleted() { return completed; }

    public void setCompleted(boolean completed) { this.completed = completed; }

    public TRANSACTION_DONE getFailed(int code, String message) {
	TRANSACTION_DONE done = new TRANSACTION_DONE("error");
	done.setSuccessful(false);
	done.setErrorNum(code);
	done.setErrorString(message);

	return done;

    }


}
